//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>

#include "Pratt2PatternsByCATH.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
using namespace std;
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
int main (int argc, char** argv) {
  
  Pratt2PatternsByCATH* pratt2PatternsByCATH = NULL;
  String*               namefileOut          = NULL;

  if (argc < 3) {
    
    cout << "Error in the input parameters! Must by like: " << endl;
    cout << "./CompactPatternsFiles <Filename Out with compact Patterns>";
    cout <<                       " <First File with Pratt2 Patterns> [Rest of File with Pratt2 Patterns]";
    cout << endl;
    
    return 0;
    
  }
  else {
    
    namefileOut          = new String(argv[1]);
    pratt2PatternsByCATH = new Pratt2PatternsByCATH ();
    
    cout << "---------------------------------------------------------------------------------" << endl;
    
    for (int i = 2, j = 1; i < argc; i++, j++) {
      pratt2PatternsByCATH->ListNamefiles()->Add(new String (argv[i]));
      cout << "      File with Pratt2 Patterns (" << j << ") : " << argv[i] << endl;
    }
    cout << " Filename Out with compact Patterns : " << argv[1] << endl;
    cout << "---------------------------------------------------------------------------------" << endl;
    
  }
  
  cout << "Preparing Files..." << endl;
  pratt2PatternsByCATH->NamefileOut(namefileOut);
  
  cout << "Loading Files..." << endl;
  pratt2PatternsByCATH->LoadDataFromListFiles();
  
  cout << "Writing Compact Pratt2 Pattern File..." << endl;
  pratt2PatternsByCATH->CreateCompactPatternFile();
  
  cout << "Finished..." << endl << "Good Bye" << endl;
  
  if (pratt2PatternsByCATH) delete pratt2PatternsByCATH;
  if (namefileOut)          delete namefileOut;

  return EXIT_SUCCESS;
  
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//

